from google.appengine.ext import db

class Shelf(db.Model):
    
    name = db.StringProperty(required = True)
    created = db.DateTimeProperty(auto_now_add = True)
    public = db.BooleanProperty()
    owner = db.UserProperty(required = True)

class ShelfItem(db.Model):

    name = db.StringProperty(required = True)
    created = db.DateTimeProperty(auto_now_add = True)
    
    # the shelf property should implicitly create the Shelf.items property
    # using google magic
    shelf = db.ReferenceProperty(Shelf,
                                 required = True, 
                                 collection_name = 'items')
    
class ShelfItemMeta(db.Model):

    # the shelf_item property should implicitly create the ShelfItem.meta 
    # property using google magic 
    shelf_item = db.ReferenceProperty(ShelfItem, 
                                      required = True, 
                                      collection_name = 'meta')
    
    name = db.StringProperty(required = True)
    created = db.DateTimeProperty(auto_now_add = True)
    type = db.StringProperty(required = True, 
                             choices = ('text', 'url', 'image'))
    value = db.StringProperty(required = True)

#
#class Profile(db.Model):
#    
#    username = db.StringProperty(required = True)
#    owner = db.UserProperty(required = True)
#    joined = db.DateTimeProperty(auto_now_add = True)
#
